<%layout("/common/layout.html"){%>

<div class="row">
    <div class="col-md-4">
        <br>
        <br>
        <ul class="nav nav-pills nav-stacked text-center">
            <li><a href="${ctxPath}/user/myInfo">我的信息编辑</a></li>
            <li><a href="${ctxPath}/user/myOrder">我的订单</a></li>
            <li><a href="${ctxPath}/user/myCollect">我的收藏</a></li>
            <li class="active"><a href="${ctxPath}/message/">我的私信</a></li>
            <li><a href="${ctxPath}/user/myNotice">我的通知</a></li>
        </ul>
    </div>


    <div class="col-md-8">
        <div class="row">

            <div class="col-md-offset-1 left mes-info list" style="display: block;">
                <div class="my-mes">
                    <div class="back">
                        <a href="${ctxPath}/message/" aria-label="back">
                            <span aria-hidden="true">&laquo;返回</span>
                        </a>
                    </div>

                    <form action="${ctxPath}/message/add" method="post">
                        <%if(message.from_id==session.user.id){%>

                        <span class="mes-to">发私信给<span class="to-name">${message.to_user.name}</span>：</span>
                        <input type="hidden" name="toId" value="${message.to_user.id}">

                        <%}else{%>

                        <span class="mes-to">发私信给<span class="to-name">${message.from_user.name}</span>：</span>
                        <input type="hidden" name="toId" value="${message.from_user.id}">
                        <%}%>


                        <div class="form-group">
                            <textarea class="form-control" rows="5" id="post-cont" name="content"></textarea>
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary btn-lg" id="send">发送</button>
                            <div class="clear-fix"></div>
                        </div>
                    </form>
                </div>
                <div class="message-box">

                    <%for(reply in page.list){%>

                    <hr>

                    <%if(session.user.id==reply.from_id){%>

                    <div class="mess-list">
                        <div class="head"><img src="${reply.from_user.img}" class="img-thumbnail"
                                               width="65px"
                                               height="65px" alt=""></div>
                        <div class="mes-two-sides">
                            <div class="user"><span class="name">${reply.from_user.name} </span>：<span
                                    class="res-con">${reply.content}</span>
                            </div>
                            <div class="date-time">${printTime(reply.time)}</div>
                        </div>
                    </div>

                    <%}else{%>

                    <div class="mess-list">
                        <div class="head"><img src="${session.user.img}" class="img-thumbnail"
                                               width="65px"
                                               height="65px" alt=""></div>
                        <div class="mes-two-sides">
                            <div class="user"><span class="name">我</span>：<span
                                    class="res-con">${reply.content}</span>
                            </div>
                            <div class="date-time">${printTime(reply.time)}</div>
                        </div>
                    </div>
                    <%}}%>


                    <nav class="row text-center">
                        <%include("/common/paginate.html",{"currentPage":page.pager.pageNumber,"totalPage":page.pager.pageCount,"actionUrl":actionUrl}){}%>
                    </nav>


                </div>
            </div>
        </div>

    </div>
</div>


<%include("/common/footer.html"){}%>

<script type="text/javascript" src="${ctxPath}/js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="${ctxPath}/js/bootstrap.min.js"></script>
<%}%>